package com.kaka.bus.engine.amount.gongjijinamount;

import com.kaka.bus.bean.BpmList;
import com.kaka.bus.bean.HttpWrapper;
import com.kaka.bus.bean.Status;
import com.kaka.bus.constant.Constant;
import com.kaka.bus.di.DataManager;
import com.kaka.bus.engine.common.impl.LoanService;
import com.kaka.bus.manager.Result;
import com.kaka.bus.mvp.RxPresenter;

import java.util.List;

import javax.inject.Inject;

public class GongJiJinPresenter extends RxPresenter<GongJiJinContract.View> implements GongJiJinContract.Presenter {
    LoanService mLoanService;

    @Inject
    public GongJiJinPresenter(DataManager dataManager, LoanService loanService) {
        super(dataManager);
        mLoanService = loanService;
        setService(mLoanService);
    }


    @Override
    public void bpmList(String userId, String token, String productId) {
        mView.showDialog(Constant.LOAD);
        mLoanService.getBpmList(userId, token, productId, new Result<HttpWrapper<List<BpmList>>>() {
            @Override
            protected void onSuccess(HttpWrapper<List<BpmList>> wrapper) {
                mView.bpmListSuccess(wrapper);
            }

            @Override
            protected void onFinish() {
                super.onFinish();
                mView.dissDialog();
            }
        });
    }

    @Override
    public void checkBpm(String userId, String token) {
        mLoanService.checkBpm(userId, token, new Result<HttpWrapper<Status>>() {
            @Override
            protected void onSuccess(HttpWrapper<Status> wrapper) {
                mView.checkBpmSuccess(wrapper);
            }
        });
    }
}
